﻿namespace Cmn
{
    using System;
    using System.Configuration;

    public class WebConfig
    {
        public static string getApp(string key)
        {
            if (ConfigurationManager.AppSettings[key] != null)
            {
                return ConfigurationManager.AppSettings[key].ToString();
            }
            return null;
        }

        public static string getConn(string key)
        {
            if (ConfigurationManager.ConnectionStrings[key] != null)
            {
                return ConfigurationManager.ConnectionStrings[key].ToString();
            }
            return null;
        }

        public static string getDefaultConn()
        {
            if (ConfigurationManager.ConnectionStrings.Count > 0)
            {
                return ConfigurationManager.ConnectionStrings["DB"].ToString();
            }
            return null;
        }
    }
}

